define(function(require, exports, module) {
    "use strict";
    var $ = require("$"),
        app = require("dist/application/app"),
        config = app.config,
        method = app.method;
        $(document).on("click",".js_first_checkbox",function(){
        	var $this=$(this),$p=$this.closest(".js_first_right"),flag=$this.prop("checked");
        	rightCheckbox(flag,$("input[type='checkbox']",$p));
        });
        $(document).on("click",".js_second_checkbox",function(){
        	var $this=$(this),$p=$this.closest(".js_second_right"),flag=$this.prop("checked"),
        	$first=$this.closest(".js_first_right"),$fcheckbox=$(".js_first_checkbox",$first),
        	clen=$(".js_second_checkbox:checked",$first).length;
        	rightCheckbox(clen,$fcheckbox);
        	rightCheckbox(flag,$("input[type='checkbox']",$p));
        });
        $(document).on("click",".js_third_checkbox",function(){
        	var $this=$(this),$p=$this.closest(".js_third_right"),flag=$this.prop("checked"),
        	$first=$this.closest(".js_first_right"),$second=$this.closest(".js_second_right"),
        	$scheckbox=$(".js_second_checkbox",$second),$fcheckbox=$(".js_first_checkbox",$first),
        	tclen=$(".js_third_checkbox:checked",$p).length;
            if($(".js_four_checkbox",$second).length){
                rightCheckbox(flag,$("input[type='checkbox']",$p));
                tclen=$(".js_third_checkbox:checked",$second).length;
            }
        	rightCheckbox(tclen,$scheckbox);
        	var clen=$(".js_second_checkbox:checked",$first).length;
        	rightCheckbox(clen,$fcheckbox);
        });
        $(document).on("click",".js_four_checkbox",function(){
            var $this=$(this),$p=$this.closest(".js_four_right"),flag=$this.prop("checked"),
            $first=$this.closest(".js_first_right"),$second=$this.closest(".js_second_right"),$three=$this.closest(".js_third_right"),
            $tcheckbox=$(".js_third_checkbox",$three),$scheckbox=$(".js_second_checkbox",$second),$fcheckbox=$(".js_first_checkbox",$first),
            fclen=$(".js_four_checkbox:checked",$p).length;
            rightCheckbox(fclen,$tcheckbox);
            var tlen=$(".js_third_checkbox:checked",$second).length;
            rightCheckbox(tlen,$scheckbox);
            var slen=$(".js_second_checkbox:checked",$first).length;
            rightCheckbox(slen,$fcheckbox);
        });
        function rightCheckbox(flag,obj){
        	if(flag){
        		obj.prop("checked",true);
        	}else{
        		obj.prop("checked",false);
        	}
        }
})